package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Wechatconfig;
import com.zjsd.sqeybusiness.service.IWechatconfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 微信配置信息Controller
 *
 * @author Zheng
 * @date 2025-03-17
 */
@RestController
@RequestMapping("/sqeybusiness/wechatconfig")
public class WechatconfigController extends BaseController
{
    @Autowired
    private IWechatconfigService wechatconfigService;

    /**
     * 查询微信配置信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:wechatconfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(Wechatconfig wechatconfig)
    {
        startPage();
        List<Wechatconfig> list = wechatconfigService.selectWechatconfigList(wechatconfig);
        return getDataTable(list);
    }

    /**
     * 导出微信配置信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:wechatconfig:export')")
    //@Log(title = "微信配置信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Wechatconfig wechatconfig)
    {
        List<Wechatconfig> list = wechatconfigService.selectWechatconfigList(wechatconfig);
        ExcelUtil<Wechatconfig> util = new ExcelUtil<Wechatconfig>(Wechatconfig.class);
        return util.exportExcel(list, "wechatconfig");
    }

    /**
     * 获取微信配置信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:wechatconfig:query')")
    @GetMapping(value = "/{configid}")
    public AjaxResult getInfo(@PathVariable("configid") Long configid)
    {
        return AjaxResult.success(wechatconfigService.selectWechatconfigById(configid));
    }

    /**
     * 新增微信配置信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:wechatconfig:add')")
    //@Log(title = "微信配置信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Wechatconfig wechatconfig)
    {
        return toAjax(wechatconfigService.insertWechatconfig(wechatconfig));
    }

    /**
     * 修改微信配置信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:wechatconfig:edit')")
    //@Log(title = "微信配置信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Wechatconfig wechatconfig)
    {
        return toAjax(wechatconfigService.updateWechatconfig(wechatconfig));
    }

    /**
     * 删除微信配置信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:wechatconfig:remove')")
    //@Log(title = "微信配置信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{configids}")
    public AjaxResult remove(@PathVariable Long[] configids)
    {
        return toAjax(wechatconfigService.deleteWechatconfigByIds(configids));
    }
}
